<?
if(!MEMBER) common::accessdenied();
if(POST) {
    switch (PARAMS) {
    default:
    case 'upload':
        $data->photos->result = profile::photo(array('ID'=>UID,'username'=>USERNAME,'image'=>$_FILES['Filedata'],'caption'=>$_POST['caption']));
    break;
    case 'mini':
        //user::miniPhoto(array('UID'=>$_SESSION['UID'],'x'=>$_POST['x'],'y'=>$_POST['y']));
    break;
    }
}
$data->profile = profile::get(array('ID'=>UID));
if(PARAMS){
    $data->profile->photo = photos::get(array('ID'=>PARAMS,'photo'=>true));
    photos::profile(array('ID'=>$data->profile->photo->ID,'album'=>$data->profile->photo->albumID,'account'=>UID));$data->profile->ID = UID;
    $data->profile->photo->mini = 'data/profile/'.UID.'/'.image::name($data->profile->ID.'mini').'.jpg';
    $data->profile->photo->thumb = 'data/profile/'.UID.'/'.image::name($data->profile->ID.'thumb').'.jpg';
    $data->profile->photo->profile = 'data/profile/'.UID.'/'.image::name($data->profile->ID.'profile').'.jpg';
}
$data->TITLE = _('Profile Photo');
$data->DESCRIPTION = _('Add a profile photo.');
?>